package question13;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;

public class Main {

    public static int getWeight(int[] arr1) {
        if (arr1.length == 1) {
            return arr1[0];
        }
        Integer[] arr = Arrays.stream(arr1).boxed().toArray(Integer[]::new);
        Arrays.sort(arr, Comparator.reverseOrder());
        while (true) {
            int min = Math.min(arr[0], arr[1]);
            arr[0] -= min;
            arr[1] -= min;
            Arrays.sort(arr, Comparator.reverseOrder());
            if (arr[1] == 0) {
                return arr[0];
            }
        }
    }

    public static void main(String[] args) {
        String[] arr = new String[5];
    }
}
